"""
演示使用send_keys()上传文件
"""
# 导包
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By

# 获取浏览器驱动对象
driver = webdriver.Chrome()

# 打开url
url = r"D:\python\python-selenium-learn\a04_元素等待\learn-files\注册A.html"
driver.get(url)

# 正确实现，使用send_keys("文件路径及文件名")
driver.find_element(By.CSS_SELECTOR, "[name='upfilea']").send_keys(r"D:\python\python-selenium-learn\a04_元素等待\learn-files\hello123.txt")

# 暂停3秒
sleep(3)

# 关闭驱动对象
driver.quit()



